/*-------------------------注册提交数据-------------------------*/
$('.registerBtn').on('click',function(){
	var userName = $('#userName').val().replace(/(^\s+)|(\s+$)/g,"");
	var userPhone = $('#userPhone').val().replace(/(^\s+)|(\s+$)/g,"");
	if(Boolean(userName) && Boolean(userPhone)){
		if(judgePhone(userPhone)){
			$.ajax({
				type:"post",
				url:"/ps/task/registerAction",
				async:true,
				data:{
					'name':userName,
					'userId':1,
					'phone':userPhone
				},
				success:function(res){
					var res = eval(res);
					if(res['code'] == 200){
						$('.href').html('http://www.psdashi.cn/ps/task/index.htm?userId='+res['data']);
						$('.hrefWrap').show();
					}else if(res['code'] == -200){
						alert('信息填写错误！');
					}else if(res['code'] == -300){
						alert('手机号已经注册过了！');
					}
				}
			});
		}else{
			
		}
	}else{
		alert('请将信息填写完整！');
	}
	
})

/*------------------------校验手机号-----------------------*/
function judgePhone(phone){
    if(!(/^1[3|4|5|7|8][0-9]\d{4,8}$/.test(phone))){ 
        alert("手机号不正确"); 
        return false; 
    }else{
    	return true;
    }
}









